import Vue from "vue";

import "normalize.css/normalize.css"; // A modern alternative to CSS resets

import ElementUI from "element-ui";
import VueScrollTo from "vue-scrollto";
import "element-ui/lib/theme-chalk/index.css";
import locale from "element-ui/lib/locale/lang/zh-CN"; // lang i18n

import "@/styles/index.scss"; // global css

import App from "./App";
import store from "./store";
import router from "./router";

import * as echarts from "echarts";
import "@/icons"; // icon
import "@/permission"; // permission control

import VideoPlayer from "vue-video-player";
require("video.js/dist/video-js.css");
require("vue-video-player/src/custom-theme.css");
Vue.use(VideoPlayer);
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */

if (process.env.NODE_ENV === "production") {
  const { mockXHR } = require("../mock");
  mockXHR();
}
ElementUI.Dialog.props.lockScroll.default = false;
// console.log("ElementUI", ElementUI);

ElementUI.MessageBox.setDefaults({
  title: null,
  message: "",
  type: "",
  iconClass: "",
  showInput: false,
  showClose: true,
  modalFade: true,
  lockScroll: false,
  closeOnClickModal: true,
  closeOnPressEscape: true,
  closeOnHashChange: true,
  inputValue: null,
  inputPlaceholder: "",
  inputType: "text",
  inputPattern: null,
  inputValidator: null,
  inputErrorMessage: "",
  showConfirmButton: true,
  showCancelButton: false,
  confirmButtonPosition: "right",
  confirmButtonHighlight: false,
  cancelButtonHighlight: false,
  confirmButtonText: "",
  cancelButtonText: "",
  confirmButtonClass: "",
  cancelButtonClass: "",
  customClass: "",
  beforeClose: null,
  dangerouslyUseHTMLString: false,
  center: false,
  roundButton: false,
  distinguishCancelAndClose: false,
});
Vue.prototype.$echarts = echarts;
Vue.prototype.$bus = new Vue();
// set ElementUI lang to EN
Vue.use(ElementUI, { locale });
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)
let scrollOptions = {
  offset: -71, // 滚动时应应用的偏移量。此选项接受回调函数
};
Vue.use(VueScrollTo, scrollOptions);
Vue.config.productionTip = false;

new Vue({
  el: "#app",
  router,
  store,
  render: (h) => h(App),
});
